Accelerated mathematical engine

ABSTRACT

Various embodiments of the disclosure relate to an accelerated mathematical engine. In certain embodiments, the accelerated mathematical engine is applied to image processing such that convolution of an image is accelerated by using a two-dimensional matrix processor comprising sub-circuits that include an ALU, output register and shadow register. This architecture supports a clocked, two-dimensional architecture in which image data and weights are multiplied in a synchronized manner to allow a large number of mathematical operations to be performed in parallel.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit under 35 USC § 119(e) toU.S. Prov. Pat. App. Ser. No. 62/536,399 (20150-2154P (P0822-1PUS)),filed on Jul. 24, 2017, entitled “Accelerated Mathematical Engine,” andlisting Peter Joseph Bannon, Kevin Altair Hurd, and Emil Talpes asinventors. The aforementioned patent document is incorporated byreference herein in its entirety and for all purposes.

BACKGROUND A. Technical Field

The present disclosure relates to an accelerated mathematical engine foroperating on large amounts of data, and more particularly, to anaccelerated mathematical engine for performing complex convolutionoperations based on matrix multiply operations.

B. Description of the Related Art

One skilled in the art will recognize the ever-increasing demands ofspeed and performance on general processors and systems that are used toimplement time-sensitive and complex mathematical operations. As thesegeneral systems are used to process large amounts of data and performcomplex mathematical operations, the computational resources and therate of calculations are limited by the capabilities of existing generalhardware designs that perform those calculations. For example,general-purpose computing devices and processors that execute matrixoperations may be unable to perform these operations in a timely mannerunder certain circumstances. Many conventional multipliers that performdigital signal processing operations rely on a series of software andhardware matrix manipulation steps (address generation, transpositions,bit-by-bit addition and shifting, etc.) and may represent a bottleneckwithin a time-sensitive system. Oftentimes, these manipulation stepsrequire the use of a processor's arithmetic functions to generateintermediate results at the expense of wasting computing time due to theadded steps of storing and fetching intermediate results from variouslocations to complete an operation.

FIG. 1 shows an example of a conventional multiplier system. Multipliersystem 100 is a scalar machine that comprises computation unit 102,registers 104, cache 106, and memory 108. In operation, computation unit102 uses registers 104 and cache 106 to retrieve data stored in memory108. Typically, computation unit 102 is a microprocessor, such as a CPUor GPU, capable of performing various computational procedures includingmatrix multiplication on input matrices to obtain a resultant matrix,e.g., by converting multiplications into additions and outputting theresult into some internal register.

For example, a dot product that represents an output pixel of an imageis typically generated by dot-multiplying individual matrix elementsfrom two matrices to obtain partial results, which are then added toobtain the final dot product. A multiplication of individual matrixelements, i.e., a scalar multiplication, is typically performed onindividual data elements by breaking up the dot multiplication into aseries of individual sub-operations. As a result, partial products haveto be stored and fetched from one or more of registers 104, cache 106,and memory 108 to complete a single arithmetic operation.

Computationally demanding applications, such as a convolution,oftentimes require a software function be embedded in computation unit102 and used to convert convolution operations into alternatematrix-multiply operations. This is accomplished by rearranging andreformatting data into two matrices that then can be rawmatrix-multiplied. However, there exists no mechanism to efficientlyshare or reuse data in scalar machine 100, such that data necessary toexecute each scalar operation has to be re-stored and re-fetched fromregisters many times. The complexity and managerial overhead of theseoperations becomes significantly greater as the amount of image datasubject to convolution operations increases.

The inability to reuse much of the data in scalar machine 100 coupledwith the added and inefficient steps of storing and fetchingintermediate results from registers 104, cache 106, and memory 108 tocomplete an arithmetic operation are only some of the shortcoming ofexisting systems, such as multiplier system 100.

Accordingly, what is needed are high-computational-throughput systemsand methods that can perform matrix mathematical operations quickly andefficiently.

BRIEF DESCRIPTION OF THE DRAWINGS

References will be made to embodiments of the invention, examples ofwhich may be illustrated in the accompanying figures. These figures areintended to be illustrative, not limiting. Although the invention isgenerally described in the context of these embodiments, it should beunderstood that it is not intended to limit the scope of the inventionto these particular embodiments. Items in the figures may be not toscale.

FIG. 1 shows an example of a conventional multiplier system.

FIG. 2 illustrates and exemplary matrix processor architecture forperforming arithmetic operations according to various embodiments of thepresent disclosure.

FIG. 3 illustrates details of an exemplary configuration of the matrixprocessor architecture shown in FIG. 2.

FIG. 4 illustrates an exemplary multiply-and-add circuit implementationof the logic circuit shown in FIG. 3.

FIG. 5 illustrates an exemplary convolution operation according tovarious embodiments of the present disclosure.

FIG. 6 through FIG. 8 illustrate details of an exemplary convolutionoperation according to various embodiments of the present disclosure.

FIG. 9 illustrates an exemplary deconvolution operation according tovarious embodiments of the present disclosure.

FIG. 10 illustrates a process for performing arithmetic operations tomake convolutional neural networks faster, according to variousembodiments of the present disclosure.

DETAILED DESCRIPTION OF EMBODIMENTS

In the following description, for purposes of explanation, specificdetails are set forth in order to provide an understanding of theinvention. It will be apparent, however, to one skilled in the art thatthe invention can be practiced without these details. Furthermore, oneskilled in the art will recognize that embodiments of the presentinvention, described below, may be implemented in a variety of ways,such as a process, an apparatus, a system, a device, or a method on atangible computer-readable medium.

Components, or modules, shown in diagrams are illustrative of exemplaryembodiments of the invention and are meant to avoid obscuring theinvention. It shall also be understood that throughout this discussionthat components may be described as separate functional units, which maycomprise sub-units, but those skilled in the art will recognize thatvarious components, or portions thereof, may be divided into separatecomponents or may be integrated together, including integrated within asingle system or component. It should be noted that functions oroperations discussed herein may be implemented as components. Componentsmay be implemented in software, hardware, or a combination thereof. Manycomponents are be formed through interconnection of many subcomponents.Subcomponents may be selected that are logically different in operationfrom what is shown herein, where these logically different subcomponentscan be combined in the aggregate with other subcomponents providesimilar or identical functionality at the aggregated component level tothat described herein (e.g., active high signals can be active low, ANDgates replaced with inverted-input NOR gates, etc).

Furthermore, connections between components or systems within thefigures are not intended to be limited to direct connections. Rather,data between these components may be modified, re-formatted, orotherwise changed by intermediary components. Also, additional or fewerconnections may be used. It shall also be noted that the terms“coupled,” “connected,” or “communicatively coupled” shall be understoodto include direct connections, indirect connections through one or moreintermediary devices, and wireless connections.

Reference in the specification to “one embodiment,” “preferredembodiment,” “an embodiment,” or “embodiments” means that a particularfeature, structure, characteristic, or function described in connectionwith the embodiment is included in at least one embodiment of theinvention and may be in more than one embodiment. Also, the appearancesof the above-noted phrases in various places in the specification arenot necessarily all referring to the same embodiment or embodiments.

The use of certain terms in various places in the specification is forillustration and should not be construed as limiting. A service,function, or resource is not limited to a single service, function, orresource; usage of these terms may refer to a grouping of relatedservices, functions, or resources, which may be distributed oraggregated.

The terms “include,” “including,” “comprise,” and “comprising” shall beunderstood to be open terms and any lists that follow are examples andnot meant to be limited to the listed items and may include subsets orsupersets of the items along with additional items. Any headings usedherein are for organizational purposes only and shall not be used tolimit the scope of the description or any claims. Each documentmentioned in this patent document is incorporate by reference herein inits entirety.

Furthermore, one skilled in the art shall recognize that: (1) certainsteps may optionally be performed; (2) steps may not be limited to thespecific order set forth herein; (3) certain steps may be performed indifferent orders; and (4) certain steps may be done concurrently.

Although embodiments herein are discussed mainly in the context ofconvolutions, one of skill in the art will appreciate that adeconvolution and other matrix operations can also be structured as amatrix-matrix type multiply operation and, thus, the principles of thepresent invention are equally applicable to deconvolutions. Furthermore,other types of mathematical operations may be implemented in accordancewith various embodiments of this disclosure.

FIG. 2 illustrates an exemplary matrix processor architecture forperforming arithmetic operations according to various embodiments of thepresent disclosure. System 200 comprises logic circuit 232 234,cache/buffer 224, data formatter 210, weight formatter 212, data inputmatrix 206, weight input matrix 208, matrix processor 240, output array226, post processing units 228, and control logic 250. Matrix processor240 comprises a plurality of sub-circuits 242 which contain ArithmeticLogic Units (ALUs), registers and, in some embodiments, encoders (suchas booth encoders). Logic circuit 232 may be a circuit that represents Ninput operators and data registers. Logic circuit 234 may be circuitrythat inputs M weight operands into matrix processor 240. Logic circuit232 may be circuitry that input image data operands into matrixprocessor 240. Weight input matrix 208 and data input matrix 206 may bestored in various types of memory including SRAM devices. One skilled inthe art will recognize that various types of operands may be input intothe matrix processor 240.

In operation according to certain embodiments, system 200 acceleratesconvolution operations by reducing redundant operations within thesystems and implementing hardware specific logic to perform certainmathematical operations across a large set of data and weights. Thisacceleration is a direct result of methods (and corresponding hardwarecomponents) that retrieve and input image data and weights to the matrixprocessor 240 as well as timing mathematical operations within thematrix processor 240 on a large scale.

In embodiments, formatters 210 212, which in example in FIG. 2 areimplemented as in-line formatters. In certain embodiments, formatters210 212 are discrete components and in other embodiments the formatters210 212 are integrated together and/or with one or more othercomponents. Each is implemented in hardware and converts a matrix to avector on operands to be operated upon within the matrix processor 240.In other embodiments, formatters 210 212 are implemented in software,although this typically produces a loss in speed. Data formatter 210converts two-dimensional or three-dimensional (e.g., a 3×3×3 cube) datacomprising data input matrix 206 into a single vector or string that maybe represented by a row or column, thereby, linearizing or vectorizingdata input matrix 206. In detail, formatter 210 receives data inputmatrix 206 and prepares input data to be processed by matrix processor240. In embodiments, this is accomplished by mapping parameters of thedata input matrix 206 into a suitable format according to the hardwarerequirements of matrix processor 240 such that matrix processor 240 canefficiently perform a matrix multiply as part of a convolutioncalculation when generating output pixels.

As an example, assuming matrix processor 240 comprises 96 rows and 96columns, data mapped into a 96×96 format would cause matrix processor240 to be utilized to its full computational capacity and, thus, providea preferred efficiency. In that case, formatter 210 should produce anoutput that is 96-columns wide. Similarly, formatter 212 should producean output that is 96-rows wide based on the weight input matrix 208.

In embodiments, formatter 210 uses a number of multiplexers or switchesto fetch some or all of data input matrix 206 and choose differentelements therefrom in order to produce data that is then lined upaccording to the columns of matrix processor 240. In embodiments, theselection ensures that the appropriate data from data input matrix 206is passed to each of the columns at defined clock cycles. Inembodiments, if weights are static, they may be pre-formatted offline,stored in memory, fetched only once, and fed directly into matrixprocessor 240 in a modified, vectorized format without the use offormatter 212. In other embodiments, weights may be dynamically adjustedand fed into matrix processor 240 in accordance with various formattingand fetching operations. In embodiments, matrix processor 240 allows forcolumn and row inputs of varying sizes. That is, matrix processor 240 isdesigned to compute N×M computations of arbitrary size.

In other embodiments, if the number of columns of the matrix processor240 is limited (for example to N columns) such that the number ofcolumns in the data input matrix 206 (for example X) is greater than thenumber of columns of the matrix processor 240 (i.e., X>N), then thecontrol logic 250 may split the data input matrix 206 into multiplesubmatricies with each submatrix computed by a matrix processor 240. Insuch instances, each matrix processor 240 may be running in a differentthread. For example, if data input matrix 206 consists of 192×96 datapoints, and the matrix processor has 96 columns and 96 rows (i.e., 96×96computations may occur in one clock cycle), the control logic 250 maysplit the data input matrix 206 into two submatricies (such as the lefthalf of the data input matrix 206 and the right half of the data inputmatrix 206). Each submatrix will consist of 96×96 data points. Eachseparately threaded matrix processor 240 can compute the output channelsfor the submatrix sent to it with results placed into the final outputarray 260, which must be large enough to hold the values from allchannels (that is 192 values). More generally, data input matrix 206 maybe split into any number of submatricies and sent to different matrixprocessors 240, each running in a separate thread. As with the outputarray 226, the data input matrix 206, data formatter 210, cache/buffer224, logic circuit 232, and post processing unit 228 must similarly beable to accommodate the larger data.

In alternative embodiments, a CNN may be computed between multiplematrix processors 240 by having control logic 250 splitting thecomputations along the inner product. The segments of the inner productare computed, each in a different matrix processor 240, and then theinput products added together to compute the output vector, which isthen stored in output array 260.

Unlike common software implementations of formatting functions that areperformed by a CPU or GPU to convert a convolution operation into amatrix-multiply by rearranging data to an alternate format that issuitable for a fast matrix multiplication, various hardwareimplementations of the present disclosure re-format data on the fly andmake it available for execution, e.g., 96 pieces of data every cycle, ineffect, allowing a very large number of elements of a matrix to beprocessed in parallel, thus efficiently mapping data to a matrixoperation. In embodiments, for 2N fetched input data 2N² compute datamay be obtained in a single clock cycle. This architecture results in ameaningful improvement in processing speeds by effectively reducing thenumber of read or fetch operations employed in a typical processorarchitecture as well as providing a paralleled, efficient andsynchronized process in performing a large number of mathematicaloperations across a plurality of data inputs.

In embodiments, to increase efficiency of matrix processor 240 that mayhave any arbitrary number of columns and rows, formatter 212 214 mayreformat different shapes of input matrices data into the columns androws suitable for matrix processor 240. In embodiments, formatting isperformed dynamically to accommodate processing of matrices havingdifferent input sizes. In embodiments, the reformatted matrixescomprising input channels are fed into cache/buffer 224.

Cache/Buffer 224 may fetch data from data input matrix 206 only 1/ktimes as various pieces of data may be reused, where k is theconvolution kernel width. For example, for any given cycle, once a rowis fetched, certain columns will have access to all the data in thatrow. In embodiments, cache/buffer 224 may be a local buffer that storesa local copy of data that may be reused by a convolution without havingto re-access and read data from SRAM.

Once matrix processor 240 has completed a computation, a set of resultmay be shifted, e.g., from the accumulators in the bottom row of matrixprocessor 240, e.g., to output flip-flops (not shown) that effectivelyform a shift register that receive a dot product. In embodiments,pulling or shifting results into output array 226, e.g., one per clockcycle, from a row that corresponds to an output channel may beaccomplished by a state machine (not shown). The state machine mayperform additional operations on the output channel, for example, priorto sending data to SRAM and/or post processing unit 228. The internaloperation of matrix processor 240 will be described in more detailbelow.

In embodiments, matrix processor 240 comprises shadow registers thatenable parallel processing by storing a copy of the results that arepassed through matrix processor 240 to output array 226. In embodiments,moving an operation result from output register to shadow registerinvolves loading the next set of values into the ALUs.

Once an accumulation has completed, a convolution may commence andaccumulation may start over before all of the data of a priorconvolution is output to output array 226. As a result, in every clockcycle, the data in matrix processor 240 may move down by one row, suchthat for each cycle the last row may be output to output array 226. Ineffect, this mode of operation ensures that a new calculation may bemade in each consecutive cycle without any interruptions and independentof additional processing operations, such as storing data in SRAM, etc.

Post processing unit 228 may comprise or interact with a number ofdevices (not shown), such as a hardware-accelerated pooling unit, a DRAMthat may be part of a direct memory access (“DMA”) that retrieves datafrom memory and stores data (e.g., weights and results) in SRAM, and thelike. The devices may be partially or entirely controlled by controllogic 250, which may also manage formatters 210 212 and other componentswithin system 200.

Not shown in FIG. 2 are auxiliary devices that perform managementfunctions, such as a sequencer that generates addresses for reading thedata, writes the results, and keeps track of where system 200 is in theconvolution in order to calculate from where to get and how to executethe data that will be used in a subsequent step of the convolution.

In certain embodiments, weight input matrix 208 is physically split anddrives weights from two different sides of matrix processor 240, suchthat the two-dimensional array is split into two regions (e.g., aleft-hand side and a right-hand side) that each receive a portion of thedata in weight input matrix 208. Such an implementation reduces datalatency by taking advantage of the fact that weights are known. Inembodiments, in order to reduce peak power consumption, the timing ofoperations may be chosen such that multiplications of weight and dataare spread out over a certain number of cycles. This efficient timing ofoperations results in a reduction of energy consuming steps including adecrease in the number of read operations performed by the matrixprocessor and improving the efficiency of data movement within thematrix (e.g., between sub-circuits).

In embodiments, a state machine (not shown) that is configured toidentify redundant data may be employed. Identified redundant data maybe reused across columns, such that the data does not need to bere-fetched. The state machine may be configured to determine how andwhere to shift data that is to be executed, e.g., based on inputsrelated to image size, filter size, stride, number of channels, andsimilar parameters.

In embodiments, a booth encoder is shared across a number of elements inthe multiplication architecture of matrix processor 240. The boothencoder may be any booth encoder known in the art and may be used tomultiply two numbers and encode one of the two numbers, e.g., from an8-bit value to a 12-bit or any other value that makes multiplicationoperations easier on the multiplier logic and, thus, faster. Inembodiments, the booth encoder may be applied in parallel across anentire row so as to share the same encoded, alternate weight valueacross all columns. By loading an operand across all columns, amultiplication may be performed in a single clock cycle across an entirerow. The cost for leveraging re-encoding to share the same data (e.g.,weights) across for N computational elements is thus paid only once foreach column (or row). In comparison, in existing computingarchitectures, every single scalar would require a booth encoder forevery single multiplication operation.

FIG. 3 illustrates details of an exemplary configuration of the matrixprocessor architecture shown in FIG. 2. In embodiments, matrix processor300 may accommodate a predetermined vector length on each axis. Asdepicted in FIG. 3, matrix processor 300 may comprise an array of 6×6tiles 302 that are arranged in a matrix format. Each tile 302 maycomprise a matrix 320 that, in turn, comprises sub-circuits circuits350. As discussed in detail below with reference to FIG. 4, eachsub-circuit circuit 350 may be a cell capable of performing arithmeticoperations. In embodiments, sub-circuit circuit 350 performssimultaneously multiplication, accumulation, and shift operations.

In embodiments, arithmetic operations are parallelized by utilizingmultiple rows and columns of matrix processor 300 to generate an N×Ntile output. For example, a given row size of 96 and a correspondingcolumn size of 96 facilitate an output of 2*9216 mathematicalcalculations. In other embodiments, the number of rows and columns maybe different. That is, there may be N rows and M columns and an N×M tileoutput may be generated. For example, for a row size of 96 and acorresponding column size of 192, an output of 2*18,432 calculations isgenerated in a single clock cycle.

FIG. 4 illustrates an exemplary multiply-and-add circuit implementationof the sub-circuit shown in FIG. 3. As depicted in FIG. 4,multiply-and-add circuit 400 comprises multiplier 430, adder 432, logic434 436 438, accumulator 424, shadow register 428, and output register440. In embodiments, accumulator 424 may be implemented as anaccumulation register.

In embodiments, accumulator 424 may comprise a set of ALUs that compriseregisters and shadow register 428 that may be configured to receive theoutputs of the ALUs.

In operation, multiplier 430 receives and multiplies weights 402 anddata 404 to generate products therefrom. Each product may be provided toadder 432 that, in response to receiving the product from multiplier430, adds the product to the current value of the accumulator 424.

In embodiments, accumulator 424 generates an accumulated value that isstored, e.g., in output register 440. The accumulated value is theresult of a convolution and, as mentioned with reference to FIG. 2, maycorrespond to the dot product of two formatted matrices.

In embodiments, a copy of the result in output register 440 may beprovided to shadow register 428, which may output result 450, such thataccumulator 424 can be accessed again to commence new calculations. Inembodiments, multiply-and-add circuit 400 in FIG. 4 may perform amultiplication, an addition operation, and a shift operation at the sametime, i.e., within a single cycle, thereby doubling the total number ofoperations that occur each cycle.

In embodiments, ClearAcc signal 408 clears the contents of accumulator424, e.g., when multiplier 430 performs a multiply operation, such thataccumulation operations can start over. In embodiments, ResultEnablesignal 412 is activated in response to a determination that data 404 isvalid. It is understood that accumulator 424 may accumulate and savedata, accumulate and clear data, or just clear data.

In embodiments, results are moved from output register 440 to shadowregister 428 in a single clock cycle, i.e., without the need ofintermediate execute and save operations.

FIG. 5 illustrates an exemplary convolution operation according tovarious embodiments of the present disclosure. Convolution 500 comprisesinput channels IC of input image 502, weights 532, dot product 514,output channels OC, and accumulator 540.

In embodiments, convolution operation 500 applies individual filters(i.e., weights) 532 to input image 502, e.g., to detect small featureswithin input image 502. By analyzing a sequence of different features ina different order, macro features may then be identified in input image502. In other embodiments, input 502 is non-image data. For example,input 502 may be non-image sensor data, such as ultrasonic, radar,LIDAR, or other sensor data. Input 502 may also be general mathematicalcomputations or any other types of data known to one of skill in theart.

Convolution 500 may use a different set of weights 532 for each inputchannel IC, as each input channel IC may contain a different set ofinformation, and each weight matrix 532 may be designed to help identifya different feature. In embodiments, convolution 500 multiplies arectangular input matrix 504 with a rectangular weight matrix 532 toobtain partial dot products. The partial dot products may then summed byadder 546 in order to generate an accumulated dot product 514 (i.e., aninteger) that represents an output pixel 514 in the output image.

In embodiments, each pixel in output channel OC is generated bymultiplier 542 and adder 544. In embodiments, the value of the partialdot products correspond to the application of weight matrix 532 in itsentirety to area 504 of the input image 502. In other words, each weight532 is dot multiplied by multiplier 542 with area 504 to produce apartial dot product, then the partial dot products are accumulated inaccumulator 540 to generate an accumulated output that represents theconvolution.

One or more input channels IC, e.g., one for each color (e.g., RGB) maybe used. For example, each convolution may use weights 532 thatrepresent three different matrices, one for each color. Each outputchannel OC 512 may be generated using a different filter or weight 532that represents a different a feature in input data 502. The number ofoutput channels may depend on the number of features. The number ofconvolutions is equal to the number of output channels OC times thenumber of input channels IC, and each convolution may have Nconvolutions for each input channel IC. One skilled in the art willrecognize that the number and type of input channels may vary and mayinclude color and/or clear inputs.

As depicted in FIG. 5, input matrix 504 is a Kx×Ky (i.e., 3×3) matrixthat may be combined with a 3×3 weight matrix 532 across 3 inputchannels, i.e., 3×3×IC, such that the depths match and produce a singleelement, dot product 514, in the output plane. Each dot product 514 inoutput channel 512 is the result of a dot multiplication.

FIG. 6 through FIG. 8 illustrate details of an exemplary convolutionoperation according to various embodiments of the present disclosure.Convolution 600 comprises input data matrix 602, weight data matrix 604,array 606, and dot product 630. In embodiments, array 606 is a matrixprocessor architecture as shown in FIG. 2 and FIG. 3.

Input data matrix 602 in FIG. 6 comprises column 610 that, inembodiments, may be obtained by linearizing an input matrix, such asrectangular input matrix 504 shown in FIG. 5, to obtain a vectorizedform of the input matrix. Similarly, weight data matrix 604 comprisesrow 620 that may be a vectorized form of a weight matrix, such asrectangular weight matrix 532 in FIG. 5. As an example, a 3×3 inputmatrix and 3 input channels may be re-formatted into a vector thatcomprises 3×3×3=27 elements from which a 27-element column 610 may beproduced for use in input data matrix 602. Conversely, a 3×3 weightmatrix for the same 3 input channels may be used to generate a27-element row 620 for use in weight data matrix 604. One skilled in theart will recognize that the sizes of input matrices and number of inputchannels may vary across different applications.

In embodiments, the input channels and input weights drawn as rectanglesin FIG. 5 are reformatted, e.g., by the formatter discussed withreference to FIG. 2, into a vector formats (e.g., vectors having 96elements) that are provided to a matrix multiplier/processor (denoted aselement 240 FIG. 2), such that a 96×96 element dot product operation canbe performed in parallel. In detail, input data 504 and input weights532 shown in FIG. 5 as rectangles for each input channel are reformattedinto vector formats.

In embodiments, the resulting vector formats, illustrated in FIG. 6 asinput data 602 and input weights 604 (e.g., each having comprising 96elements) are provided to matrix processor or matrix multiplier 240 thatperforms a 96×96 element dot product operation in parallel. Inembodiments, in the calculation of output channels, the same outputpixels are produced using the same set of input data but different setof weights (i.e., filters), such that by reading the input data oncemany output channels can be generated at once. As stated above, it isunderstood that the number of input and output channels may bearbitrarily chosen.

It is further understood that input data matrix 602, weight data matrix604, and array 606 may have different numbers of columns and rows asthose depicted in FIG. 6. In particular, the shapes of input data matrix602 and weight data matrix 604 may be formatted such as to accommodatethe columns and rows of any arbitrate configuration of array 606. Inaddition, in circumstances in which weight data matrix 604 is known thenrow 620 may be generated and stored in a vectorized format without theuse of a formatter.

In embodiments, dot product 630 in FIG. 6 is generated bydot-multiplying a vector corresponding to column 610 with a vectorcorresponding to row 620. In embodiments, as shown in FIG. 7, the nextdot product 632 may be obtained by dot-multiplying a vectorcorresponding to column 612 with the vector corresponding to row 620. Asthose of skill in the art will recognize, once all dot products in thefirst row of array 606 are filled, the dot product of the second row ofarray 606 may be calculated by dot-multiplying the elements in firstcolumn 610 of input data matrix 602 with the second row of weight datamatrix 604, etc.

It is important to note that FIG. 6 through FIG. 8 merely serveillustrative purposes and that the abovementioned dot-multiplicationsmay be simultaneously performed to generate a one-shot matrix-matrixmultiply operation.

FIG. 9 illustrates an exemplary deconvolution operation according tovarious embodiments of the present disclosure. Deconvolution system 900comprises input channels IC of input image 902, weights 922, dot product904 906, and output channels OC. A person of skill in the art willrecognize that, the deconvolution operation 900 is, in effect, is amathematical transposition (approximately the inverse) of theconvolution operation, for example, the convolution shown in FIG. 5. Oneof skill in the art will further recognize that a neural network may beused to learn deconvolution operation 900 by applying procedures similarto those used for ordinary convolutional neural networks. For purposesof brevity, a description or functions of components similar to those inFIG. 5 is not repeated here.

In embodiments, deconvolution operation 900 in FIG. 9 reassemblesmatrices 912 by deconstructing dot product 904 906 using weights 922. Aswith a convolution operation, deconvolution 900 may use a different setof weights 922 for each input channel IC. In embodiments, deconvolution900 may be advantageously applied to an image to perform imagedeconvolution, for example to improve robustness against artifacts.Other applications may include analysis and restoration of image data,and the like.

FIG. 10 illustrates a process for performing arithmetic operations toaccelerate convolutional neural networks according to variousembodiments of the present disclosure.

Process 1000 for performing arithmetic operations begins at step 1002when a first set of operands that may be representative of a row in adata matrix is received from a first logic circuit. This first set ofoperands may be vectorized such that the operands are aligned withinputs into a matrix processor. In certain embodiments, the size of thevectorized operands is directly related to the number of inputs into amatrix processor along on axis.

At step 1004, a second set of operands that may be representative of acolumn in a weight matrix is received from a second logic circuit. Thissecond set of operands may be vectorized such that the operands arealigned within corresponding inputs into the matrix processor. Incertain embodiments, the size of the vectorized operands is directlyrelated to the number of inputs into the matrix process along adifferent axis.

At step 1006, the first set of operands is dot-multiplied with thesecond set of operands to obtain one or more dot-products. In certainembodiments, this set operation across the sets of operands is performedin a single clock cycle.

At step 1008, the dot-products may be used to convolve an image with afilter to produce a convolution result.

At step 1010, the convolution result is further processed to enhance theimage output. This further processing may occur using a non-linearfunction, a normalization operation or a pooling operation.

One skilled in the art will recognize no computing system or programminglanguage is critical to the practice of the present invention. Oneskilled in the art will also recognize that a number of the elementsdescribed above may be physically and/or functionally separated intosub-modules or combined together.

It shall be noted that elements of the claims below may be arrangeddifferently including having multiple dependencies, configurations, andcombinations. For example, in embodiments, the subject matter of variousclaims may be combined with other claims.

It will be appreciated to those skilled in the art that the precedingexamples and embodiment are exemplary and not limiting to the scope ofthe present invention. It is intended that all permutations,enhancements, equivalents, combinations, and improvements thereto thatare apparent to those skilled in the art upon a reading of thespecification and a study of the drawings are included within the truespirit and scope of the present invention.

The invention claimed is:
 1. A matrix processor for acceleratingconvolutions in a neural network, the matrix processor comprising: afirst input circuit arranged in a first dimension of a two-dimensionalarray, the first input circuit being coupled to receive N operands froma first logic circuit, the N operands being formatted in accordance witha first width related to the first dimension, wherein the N operandsrepresent a first input region of a plurality of input regions obtainedfrom image data; a second input circuit arranged in a second dimensionof the two-dimensional array, the second input circuit coupled toreceive M operands from a second logic circuit, the M operands beingformatted in accordance with a second width related to the seconddimension, wherein the M operands represent first weight values of afirst filter of a plurality of filters; and a plurality of sub-circuitscoupled to receive the N operands and the M operands, at least a subsetof the plurality of sub-circuits comprising an arithmetic logic unit, anaccumulator and a shadow register, the sub-circuits coupled within thetwo-dimensional array to perform a dot product calculation of the Noperands and the M operands, such that the first input region isconvolved with the first filter, wherein remaining input regions of theplurality of input regions are received and convolved with the firstfilter, and wherein the sub-circuits are configured to receive, from thesecond input circuit, second weight values of a second filter of theplurality of filters.
 2. The matrix processor according to claim 1wherein the arithmetic logic unit comprises a multiply-and-add circuitto generate the dot product.
 3. The matrix processor according to claim1 wherein at least some of the sub-circuits comprise an encoding elementconfigured to encode values representing one or more of the M operands.4. The matrix processor according to claim 3 wherein the encodingelement is a booth encoder.
 5. The matrix processor according to claim 1wherein the N operands are formatted from a data input matrix.
 6. Thematrix processor according to claim 1 further comprising a state machinethat uses at least one of a filter size and a stride to determinereusable operands within the N operands or the M operands.
 7. The matrixprocessor according to claim 1 wherein accelerated processing speed isachieved by a reduction in read operations from a cache and accelerateddata throughput via the plurality of sub-circuits.
 8. A system foraccelerating convolutions in a neural network, the system comprising: afirst logic circuit that generates N operands; a first input circuitarranged in a first dimension of a two-dimensional array, the firstinput circuit being coupled to receive the N operands from the firstlogic circuit wherein the N operands represent a first input region of aplurality of input regions obtained from image data; a second logiccircuit that generates M operands; a second input circuit arranged in asecond dimension of the two-dimensional array, the second input circuitbeing coupled to receive M operands from the second logic circuit,wherein the M operands represent first weight values of a first filterof a plurality of filters; a matrix processor comprising a plurality ofsub-circuits, the plurality of sub-circuits configured to performdot-multiplications of the N operands and the M operands to generatedot-products, such that the first input region is convolved with thefirst filter, at least a subset of the plurality of sub-circuitscomprising an arithmetic logic unit, an accumulator and a shadowregister, wherein remaining input regions of the plurality of inputregions are received and convolved with the first filter, and whereinthe sub-circuits are configured to receive, from the second inputcircuit, second weight values of a second filter of the plurality offilters; and an output array coupled to the two-dimensional array, thetwo-dimensional array configured to use the dot-products to generate aresult.
 9. The system according to claim 8 wherein the N operands areformatted from a data input matrix into a first vector and the Moperands are formatted from a weight input matrix into a second vector,the data input matrix including the plurality of input regions and theweight input matrix including the plurality of filters.
 10. The systemaccording to claim 9 wherein the first logic circuit comprises aplurality of data registers that store the N operands, the plurality ofdata registers having a first width corresponding to the first dimensionof the two dimensional array and the second logic circuit comprises aplurality of weight registers that store the M weight operands, theplurality of weight registers having a second width corresponding to thesecond dimension of the two dimensional array.
 11. The system accordingto claim 10 wherein the first width corresponds to a number of cyclesthat generate the result.
 12. The system according to claim 10 whereinthe data register and the weights register are accessed only once tofetch respective a first and second number of elements.
 13. The systemaccording to claim 8 wherein the shadow registers move data, in one ormore clock cycles, to a shift register.
 14. The system according toclaim 9 further comprising a buffer coupled to at least one of the datainput matrix and the weight input matrix, the buffer stores a copy ofrecently used data to enable reuse without refetching in subsequentcycles.
 15. The system according to claim 8 wherein the result isincluded in an output matrix, the result corresponding corresponds to anapplication of the first filter to the first input region.
 16. Thesystem according to claim 8 further comprising a state machine that usesat least one of a filter size and a stride to identify reusable data.17. A method for using a matrix multiplication circuit to makeconvolutional neural networks faster, the method comprising: receiving,from a first logic circuit, a first set of operands representative of arow in a data matrix, wherein the first set of operands represent afirst input region of a plurality of input regions obtained from imagedata; receiving, from a second logic circuit, a second set of operandsrepresentative of a column in a weight matrix, wherein the columnrepresents a first filter of a plurality of filters; using a pluralityof sub-circuits, which comprise an arithmetic logic unit, an accumulatorand a shadow register, to dot-multiply the first set of operands withthe second set of operands to obtain one or more dot-products; and usingthe dot-products to convolve the first input region with the firstfilter to produce a convolution result, wherein remaining input regionsof the plurality of input regions are convolved, using the sub-circuits,with the first filter, and wherein subsequent to the plurality of inputregions being convolved with the first filter, a second filter of theplurality of filters is convolved, using the sub-circuits, with thefirst input region.
 18. The method according to claim 17 whereinconvolving the image comprises processing the one or more dot-productsby a convolution layer to generate a layer output.
 19. The methodaccording to claim 18 wherein generating the layer output comprisesapplying one of a non-linear function, a normalization, and a pooling tothe convolution result.
 20. The matrix processor according to claim 1,wherein the shadow register represents a shift register configured tooutput a result of the dot product calculation received from theaccumulator.
 21. The system according to claim 13, wherein the shadowregister is configured to receive information from the accumulator.